﻿<Window x:Class="WOzTestUI.SpeechWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Audio Prompts"
    SizeToContent="Width"
    ResizeMode="CanResize"
    xmlns:local="clr-namespace:WOzTestUI"
    xmlns:WozLib-Containers="clr-namespace:WozLib.UI.Containers;assembly=WozLib"
    x:Name="_SpeechWindow"
    Height="300"
    >
  <Window.Resources>

    <DataTemplate DataType="{x:Type local:StringToSpeak}">
      <Grid Margin="2">
        <Rectangle Fill="LightGray" Stroke="Black" StrokeThickness="0.5" Margin="0" RadiusX="3" RadiusY="3"/>
        <Grid Margin="4">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBlock Grid.Column="0" Margin="5" VerticalAlignment="Center" FontFamily="Verdana" MinWidth="100" MaxWidth="180"
                     TextWrapping="Wrap"
                     FontSize="12" Foreground="Black" Text="{Binding Path=Data}" />

          <Button Grid.Column="1" Margin="3" 
                  Command="local:SpeechWindow.SpeakCommand" CommandParameter="{Binding}">speak</Button>

        </Grid>
      </Grid>
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:AudioToPlay}">
      <Grid Margin="2">
        <Rectangle Fill="LightGray" Stroke="Black" StrokeThickness="0.5" Margin="0" RadiusX="3" RadiusY="3"/>
        <Grid Margin="4">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBlock Grid.Column="0" Margin="5" VerticalAlignment="Center" FontFamily="Verdana" MinWidth="100" MaxWidth="180"
                     TextWrapping="Wrap"
                     FontSize="12" Foreground="Black" Text="{Binding Path=Data}" />

          <Button Grid.Column="1" Margin="3" 
                  Command="local:SpeechWindow.PlayCommand" CommandParameter="{Binding}">play</Button>

        </Grid>
      </Grid>
    </DataTemplate>
    
  </Window.Resources>
    <Grid>
      <!--MaxHeight="600"-->
      <!--MaxWidth="400" MinWidth="180"-->
      <Grid>
        
        <Grid.RowDefinitions>
          <RowDefinition Height="*"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <WozLib-Containers:ReorderableListBox 
          Grid.Row="0" x:Name="_TextToSpeakList" 
          Margin="1" 
          ItemsSource="{Binding ElementName=_SpeechWindow, Path=AudioPromptCollection}">
          
        </WozLib-Containers:ReorderableListBox>
        
        <StackPanel Grid.Row="1" Orientation="Horizontal">
          <TextBlock VerticalAlignment="Center" Margin="3">text to speak</TextBlock>
          <TextBox x:Name="_TextToSpeak" TextWrapping="Wrap" MinWidth="140" MaxWidth="140" Margin="3"></TextBox>
          <Button x:Name="_AddSpeakButton" Margin="3">add</Button>
          <Button x:Name="_SpeakButton" Margin="3">speak</Button>
        </StackPanel>

        <StackPanel Grid.Row="2" Orientation="Horizontal">
          <TextBlock VerticalAlignment="Center" Margin="3">audio file</TextBlock>
          <TextBox x:Name="_AudioFilename" TextWrapping="Wrap" MinWidth="140" MaxWidth="140" Margin="3"></TextBox>
          <Button x:Name="_OpenAudioButton" Margin="3">open</Button>
          <Button x:Name="_AddAudioButton" Margin="3">add</Button>
          <Button x:Name="_PlayButton" Margin="3">play</Button>
        </StackPanel>
      </Grid>
    </Grid>
</Window>
